//
//  RewardRecordCell.m
//  ImGuider
//
//  Created by 李陆涛 on 2018/1/23.
//  Copyright © 2018年 imguider. All rights reserved.
//

#import "RewardRecordCell.h"

@interface RewardRecordCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *coinLabel;

@end

@implementation RewardRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setModel:(RewardRecordModel *)model {
    
    _model = model;
    
    [self.headImageView setImageURL:[NSURL URLWithString:model.headimg] placeholderImage:[UIImage imageNamed:@"default"]];
    self.nameLabel.text = model.realname;
    self.timeLabel.text = model.ordertime;
    
    NSString *text = [NSString stringWithFormat:@"%@%@",model.amount,MYLocalizedString(@"PUBLIC_COIN_NAME", nil)];

    NSRange range = [text rangeOfString:model.amount];

    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text];
    attr.font = Font(12);
    attr.color = kContentColor;

    [attr addAttribute:NSForegroundColorAttributeName value:kThemeColor range:range];

    self.coinLabel.attributedText = attr;
}

@end
